package jfae.core.configuration.contributions;

import java.util.LinkedHashMap;

public class BaseContribution<T> extends LinkedHashMap<String, T> implements Overriding<T>, Contribution<T>{

	private static final long serialVersionUID = 1L;

	@Override
	public void add(String contributionId, T contribution){
		if(containsKey(contributionId)){
			throw new DuplicateContributionException(contributionId, contribution);
		}
		put(contributionId, contribution);
	}

	@Override
	public void override(String contributionId, T contribution, boolean forceInsert) {
		if(containsKey(contributionId) || forceInsert){
			put(contributionId, contribution);
		}
	}

}
